import { Table, Tag, Button } from "antd";

export const EvaluationTable = ({ papers, onEdit }) => {
  const columns = [
    {
      title: '考生',
      dataIndex: 'studentName',
      width: 120
    },
    {
      title: '试卷名称',
      dataIndex: 'paperName',
      width: 200
    },
    {
      title: '状态',
      width: 100,
      render: (_, record) => (
        <Tag color={record.status === '已阅' ? 'green' : 'orange'}>
          {record.status}
        </Tag>
      )
    },
    {
      title: '操作',
      width: 100,
      render: (_, record) => (
        <Button
          type="link"
          onClick={() => onEdit(record)}
          style={{ padding: 0 }}
        >
          评阅
        </Button>
      )
    }
  ];

  return (
    <Table
      dataSource={papers}
      columns={columns}
      rowKey="id"
      pagination={false}
      bordered
      size="middle"
    />
  );
};
